package com.marvels.financial.loan.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.financial.loan.service.PaymentResultQueryTaskletApi;
import com.marvels.financial.loan.service.TimePullWaitLendInfoApi;
import com.marvels.financial.loan.service.TimingPaymentTaskTaskletApi;
import com.marvels.financial.loan.service.TimingWithholdTaskTaskletApi;
import com.marvels.financial.loan.service.WithholdResultQueryTaskletApi;

/**
 * 财务定时任务controller
 * 
 * @author tangpw
 *
 */
@RestController
@RequestMapping("financial/loan/batch/api")
public class FinancialBatchController {

	@Autowired
	private PaymentResultQueryTaskletApi paymentResultQueryTaskletApi;

	@Autowired
	private TimingPaymentTaskTaskletApi timingPaymentTaskTaskletApi;

	@Autowired
	private TimingWithholdTaskTaskletApi timingWithholdTaskTaskletApi;

	@Autowired
	private WithholdResultQueryTaskletApi withholdResultQueryTaskletApi;
	
	
	@Autowired
	private TimePullWaitLendInfoApi timePullWaitLendInfoApi;
	

	/**
	 * 放款结果查询定时任务
	 */
	@RequestMapping("paymentResultQueryTask")
	public void paymentResultQueryTask() {
		MarvelsLogUtil.getInstance().info(">>>>>>放款结果查询定时任务controller开始");
		paymentResultQueryTaskletApi.paymentResultQuery();
		MarvelsLogUtil.getInstance().info(">>>>>>放款结果查询定时任务controller结束");
	}

	/**
	 * 放款定时处理任务(代扣保险费的，注销掉)
	 */
	@RequestMapping("qiAnWithholdQueryTask")
	public void qiAnWithholdQueryTask() {
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>>>放款定时处理任务controller开始");
		//qiAnWithholdQueryTaskletApi.qiAnResultQuery();
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>>>放款定时处理任务controller结束");
	}

	/**
	 * 放款定时处理任务
	 */
	@RequestMapping("timingPaymentTaskTask")
	public void timingPaymentTaskTask() {
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>>>放款定时处理任务controller开始");
		timingPaymentTaskTaskletApi.timingPayment();
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>>>放款定时处理任务controller结束");
	}

	/**
	 * 定时代扣还款计划
	 */
	@RequestMapping("timingWithholdTaskTask")
	public void timingWithholdTaskTask() {
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>定时代扣还款计划controller开始");
		timingWithholdTaskTaskletApi.timingWithhold();
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>定时代扣还款计划controller开始");
	}

	/**
	 * 定时代扣还款计划结果查询
	 */
	@RequestMapping("withholdResultQueryTask")
	public void withholdResultQueryTask() {
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>定时代扣还款计划结果查询controller开始");
		withholdResultQueryTaskletApi.withholdResultQuery();
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>定时代扣还款计划结果查询controller结束");
	}
	
	
	

	
	
	
	
	/**
	 * 根据产品  资金源拉取待放款数据
	 */
	@RequestMapping("pullWaitLendInfo")
	public void pullWaitLendInfo() {
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>定时对账controller开始");
		timePullWaitLendInfoApi.pullWaitLendInfo();
		MarvelsLogUtil.getInstance().info(">>>>>>>>>>定时对账controller结束");
	}
}
